#include "../GenericTypeDefs.h"
#include "stdint.h"

#ifndef _M_UART4_H
#define _M_UART4_H

#define IO_BUF_LEN  (256)

#define IOLEN   (256)
#define TX_FULL (U4STA & _U4STA_UTXBF_MASK)
#define RX_FULL (U4STA & _U4STA_URXDA_MASK)

extern uint8_t IoRxHead;
extern uint8_t IoRxTail;
extern uint8_t IoTxHead;
extern uint8_t IoTxTail;
extern uint8_t IoTxData[IO_BUF_LEN];
extern uint8_t IoRxData[IO_BUF_LEN];

//extern void InitUart2(void);
extern void IoComm_RxTx(void);

typedef struct
{
	uint8_t RxHead;
	uint8_t RxTail;
	uint8_t TxHead;
	uint8_t TxTail;
	uint8_t TxData[IOLEN];
	uint8_t RxData[IOLEN];
	uint8_t FuncCode;
	uint8_t RecPackLen;
	uint8_t RecStatus;
	uint8_t Active;
	uint16_t RecCrc;
    uint16_t CalCrc;
}IOCOMM;
extern IOCOMM IoComm;

#endif
